﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NigiriClub.WebUI.Models
{
    public partial class Tag
    {
        public static List<Tag> GetTags(Entities db, string[] tagNames)
        {
            List<Tag> result = new List<Tag>();
            foreach (var tagName in tagNames)
            {
                Tag tag = db.Tag.FirstOrDefault(t => t.Name.Equals(tagName));
                if (tag == null)
                {
                    tag = new Tag() { Name = tagName };
                }
                result.Add(tag);
            }
            return result;
        }
    }
}